package com.example.coursehub.entity;

import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;

@Getter
@Setter
@Entity
@Table(name = "classes", schema = "courseHub")
public class Classes {
    @Getter
    @Id
    @Column(name = "classes_id", nullable = false, length = 100)
    private String classesId;

    @Column(name = "classes_name", nullable = false, length = 100)
    private String classesName;

    @ManyToOne(fetch = FetchType.EAGER, optional = false)
    @OnDelete(action = OnDeleteAction.CASCADE)
    @JoinColumn(name = "course_id", nullable = false)
    private Course course;
}